<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <div style="font-size: 24px">promise的基本用法</div>
    <script>
      const promise = new Promise((resolve, reject) => {
        //resolve,reject只能调其中一个
        resolve("xujingquan");
        // reject(new Error("promise rejrcted"));
      });
      //  then里面包含两个参数，分别为两个对象
      promise.then(
        (res) => {
          console.log(res);
        },
        (err) => {
          console.log(err);
        }
      );
    </script>
  </body>
</html>
